package ar.com.huargo.easyio.io;

import java.io.IOException;
import java.io.RandomAccessFile;

public class FileAppendWriter extends FileWriter {

	protected RandomAccessFile raf;
	
	public FileAppendWriter(String filename) {
		super(filename);
	}
	
	@Override
	public void create() throws IOException{
		this.raf = new RandomAccessFile(this.filename, "rw");
		this.raf.seek(this.raf.length());
	}
	
	@Override
	public void write(String string) throws IOException{
		this.raf.writeChars(string);
	}
	
	@Override
	public void writeLn(String string) throws IOException{
		this.write(string);
		this.write("\n");
	}
	
	@Override
	public void close() throws IOException{
		this.raf.close();
	}

}
